﻿using System;
using System.Runtime.InteropServices;
using VMExplorer.Win32;

namespace VMExplorer
{
	class SafeProcessHandle : SafeHandle
	{
		public SafeProcessHandle () : base (IntPtr.Zero, true) { }
		public SafeProcessHandle (IntPtr handle, bool ownsHandle) :
			base (IntPtr.Zero, ownsHandle)
		{
			base.handle = handle;
		}

		public override bool IsInvalid
		{
			get { return base.handle == IntPtr.Zero; }
		}

		protected override bool ReleaseHandle ()
		{
			return Native.CloseHandle (base.handle);
		}
	}
}
